 /////////////////////////////LINES'CRAFT\\\\\\\\\\\\\\\\\\\\\\\\\\\

package LinesCraft;

import java.util.Scanner;
import java.util.StringTokenizer;

import javax.swing.*;

public class LinesCraft extends JFrame {
// this new release of eclipse breaks the command lines terribly, sorry for that.
	static Inventory inv = new Inventory();

	// creating items
	// I had to make all of them static because fuck you. (you couldn't use them as parameter of methods(ex. add() or drop())

	static Items bow = new Items(0, "Bow");

	static Items woodenShovel = new Items(1, "Wooden Shovel");
	static Items woodenPickaxe = new Items(1, "Wooden Pickaxe");
	static Items woodenAxe = new Items(1, "Wooden Axe");

	static Items stoneShovel = new Items(2, "Stone Shovel");
	static Items stonePickaxe = new Items(2, "Stone Pickaxe");
	static Items stoneAce = new Items(2, "Stone Axe");

	static Items ironShovel = new Items(3, "Iron Shovel");
	static Items ironPickaxe = new Items(3, "Iron Pickaxe");
	static Items ironAxe = new Items(3, "Iron Axe");

	static Items diamondShovel = new Items(4, "Diamond Shovel");
	static Items diamondPickaxe = new Items(4, "Diamond Pickaxe");
	static Items diamondAxe = new Items(4, "Diamond Axe");

	static Items woodenHelmet = new Items("Wooden Helmet", 20, 0); // why not? if you can bend diamond you can bend wood and stone too.
	static Items woodenChestplate = new Items("Wooden Chestplate", 50, 0);
	static Items woodenLeggings = new Items("Wooden Leggings", 20, 0);
	static Items woodenBoots = new Items("Wooden Boots", 20, 0);

	static Items stoneHelmet = new Items("Stone Helmet", 50, 1);
	static Items stoneChestplate = new Items("Stone Chestplate", 125, 2);
	static Items stoneLeggings = new Items("Stone Leggings", 120, 3);
	static Items stoneBoots = new Items("Stone Boots", 100, 4);

	static Items ironHelmet = new Items("Iron Helmet", 166, 1);
	static Items ironChestplate = new Items("Iron Chestplate", 241, 2);
	static Items ironLeggings = new Items("Iron Leggings", 226, 3);
	static Items ironBoots = new Items("Iron Boots", 196, 4);

	static Items diamondHelmet = new Items("Diamond Helmet", 364, 1);
	static Items diamondChestplate = new Items("Diamond Chestplate", 529, 2);
	static Items diamondLeggings = new Items("Diamond Leggings", 496, 3);
	static Items diamondBoots = new Items("Diamond Boots", 430, 4);

	static Items stone = new Items("Stone");
	static Items cobblestone = new Items("Cobblestone");
	static Items dirt = new Items("Dirt");
	static Items wood = new Items("Wood");
	static Items trunk = new Items("Trunk");
	static Items stick = new Items("Stick");
	static Items coal = new Items("Coal");
	static Items torch = new Items("Torch");
	static Items wool = new Items("Wool");
	static Items bed = new Items("Bed");
	static Items ironOre = new Items("Iron Ore");
	static Items diamond = new Items("Diamond");
	static Items sand = new Items("Sand");
	static Items glass = new Items("Glass");
	static Items bricks = new Items("Bricks");
	static Items obsidian = new Items("Obsidian");
	static Items wheatSeeds = new Items("Wheat Seeds");
	static Items pumpkinSeeds = new Items("Pumpkin Seeds");
	static Items chest = new Items("Chest");
	static Items furnace = new Items("Furnace");
	static Items workbench = new Items("Workbench");
	static Items bucket = new Items("Bucket");
	static Items waterBucket = new Items("Bucket of water");
	static Items lavaBucket = new Items("Bucket of lava");
	static Items gravel = new Items("Gravel");

	static Items rawChicken = new Items("Chicken", 4);
	static Items friedChicken = new Items("Fried Chicken", 8); // its name is fried cuz the mob's name is chicken too and that would be confusing and buggy.
	static Items rawPorkchop = new Items("Raw Porkchop", 4);
	static Items porkchop = new Items("Fried Porkchop", 8);
	static Items rawBeef = new Items("Raw Beef", 4);
	static Items beef = new Items("Beef", 8);
	static Items rawFlesh = new Items("Flesh", 2);
	static Items flesh = new Items("Fried Flesh", 4); // you can't tell me why in minecraft you cant cook zombie flesh... +1 point to Lines'Craft!

	static Items bone = new Items("Bone");
	static Items boneMeal = new Items("Bone Meal");

	static Items feather = new Items("Feather");
	static Items flint = new Items("Flint");
	static Items arrow = new Items("Arrow");

	static boolean night;

	static int time = 0; /*
						 * Plan: with every move(go()) 1 time passes, from 20-6 it is night and hostile mobs spawn, once it reaches
						 * 25 it goes back to zero. Zombies and skeletons die, spiders wont attack if time is under 12, and at 0 new
						 * animals spawn in every block if the block has less than 2 animals.
						 */
						/* More plan: 
						 * once, when I get quite finished up with some stuff it should
						 * be like there would be 240 or 2400 time spaces and even attacking or
						 * crafting, mining, building structures would take time. everything.
						 */

	Player player = new Player();

	public static void main(String args[]) {

		// Here's a li'l story for you:		
		/*System.out
				.println("You wake up quite dizzy after this ship tour. You try to open your eyes but you dont really see anything.\n"
						+ "After your vision gets a little bit clearer you see your ship on the beach of the island you landed on. You begin searching for your wife on the ship.\n"
						+ "You get crazy, its just dead bodies everywhere. You get into your room. There's no sign of her. Just when you want to leave the room you hear\n"
						+ "A woman's sound from inside of your bed. You open the bed and you find her inside."
						+ "The ship doesnt look like it is ever going to work again... You are stranded here.\n "
						+ "You get out of the ship. You break a piece of wood out of it for future plans.\n"
						+ "Wooden Shovel Acquired!\n\n"
						+ "You go around searching this island you've landed on.\n"
						+ ".\n.\n.\n");		//It would be awesome if the text would continue after an enter press here.

		System.out
				.println("It's getting dark. You've been walking all day. The island is full of animals. But the strange thing is... The tempreture...\n"
						+ "and quite much the weather of this island... is FÖLDÖNKÍVÜLI. Only a few of meters from where it's snowing there is a jungle, and\n"
						+ "another bunch of meters from the jungle there's a desert. You must be really far from the broken ship now. You both get quite scared\n"
						+ "becouse of this creepy island. After several hours of walking you finally meet humans!\n"
						+ "But they are quite strange too. They don't ever talk. They all have huge heads and noses, and they always keep their hands folded.\n"
						+ "They never talk. You walk into one of their houses and ask where you are. The stranger looks at you, but doesn't say one word.\n"
						+ "You ask around the village but noone talks neither to you, neither to anyone else. After you make sure that theese people are harmless\n"
						+ "You just get into one of their beds with your wife and sleep. Tomorrow... You will need to begin building your new life.\n.\n.\n.\n");
											//and here too
		System.out
				.println("When you wake up you tell your wife to stay with these strangers, you take that piece of wood you broke from the ship and walk out of your house.\n"
						+ "Just when you've almost left the village you see a strange thing. You rub your eyes, and get closer to that thing. It looked like an iron monster.\n"
						+ "It didn't try to harm you. You finally realized that this island is nothing like any other islands. Now finally let's move to a direction and\n"
						+ "explore this place.\n"
				// + "Hint: You can get every command with the command 'help'."
				);
		*/
		
		/*while (time > 12) {	//nope, this is a stupid way. and it wouldn't work. just left it here so i remember.
			night = true;
		}*/
		
		start();
	}

	static void start(){	//only once used, i just made it because i think the code is cleaner like this. maybe im wrong...
		//adding starting item
		inv.add(woodenShovel, 1);	// I had to make every item static, I don't know what will that affect.
		// listing player's inventory
		inv.list();
		Map.showLoc();
		command();
	}
	
	
	static String input;
	static String[] words = new String[10]; // hopefully there won't be 10 word long commands, I'll do what I can :D(that would ruin the feeling)
	static Scanner in = new Scanner(System.in);
	
	static void command(){
		input = in.nextLine();
		StringTokenizer toWords = new StringTokenizer(input, " ");
		int i = 0;
		while (toWords.hasMoreTokens()) {
			words[i] = toWords.nextToken();
			i++;
		}
		System.out.println(words[0] + " " + words[1]);	// debug help
	}
	
	
	void timeCost(int hours) { // everything that you "do" should call this
								// method, check where I initialized time for
								// more details(way up)
		time = time + hours;
		if (time > 24) {
			time = time - 24; // for example when you begin to do a 6 hours job at 23 don't be able to finish it at 24 only 5.
		}
		for(int i=0; i<hours; i++){		//auto regeneration	
		player.health=player.health+1;	
		}
	}

	void showTime() { // command should be "time"
		System.out.println("It's " + time + " o'clock");
	}

}